package com.googlecode.hyakutaded.pubsub;

import java.util.HashMap;
import java.util.Map;

public class Topics {
	private Map<String, Topic> topics = new HashMap<String, Topic>();
	private static Topics instance = new Topics();

	public static Topics getInstance() {
		return instance;
	}

	public synchronized Topic getTopic(String topic) {
		if (!topics.containsKey(topic)) {
			Topic t = new Topic(topic);
			topics.put(topic, t);

		}
		return topics.get(topic);
	}

}
